#ifndef SERIAL_PORT_H
#define SERIAL_PORT_H

#include <QObject>
#include <QSerialPort>
#include <QSerialPortInfo>

class SerialPort : public QSerialPort {
    Q_OBJECT

public:
    explicit SerialPort(QObject *parent = nullptr);
    ~SerialPort();

    bool open(const QString &portName, int baudrate);
    void close();
    void HandleData();

signals:
    void dataReceived(const QByteArray &data);

private slots:
    void onReadyRead();
};

#endif // SERIAL_PORT_H